package com.example.dps;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast;
import com.downpayment.dps.R;

public class BonusPointsActivity extends Activity {
	
	ActionBarHelper actionBarHelper;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.bonus_points_intro_layout);
		
		this.actionBarHelper = new ActionBarHelper(this);
		
		actionBarHelper.makeBar();
		
		
		Utility.adjustBackground(this);
		
		
		
		ImageView continueButton = (ImageView) findViewById(R.id.continueButton);
		
		continueButton.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				setContentView(R.layout.bonus_points_layout);
				
				actionBarHelper.makeBar();
				Utility.adjustBackground(BonusPointsActivity.this);
				
				addRedeemButton();
				
			}
			
		});
		
		
		
		
	}
	
	
	public void addRedeemButton(){
		
		ImageView redeem = (ImageView) findViewById(R.id.redeemButton);
		
		redeem.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				
				showDialog(1);
				
			}
			
		});

	}
	
	
	@Override
	public Dialog onCreateDialog(int id){
		
		AlertDialog.Builder builder = null;
		LayoutInflater inflater = null;
		
		switch (id) {
		default:
			builder = new AlertDialog.Builder(this);
		    // Get the layout inflater
		    inflater = this.getLayoutInflater();

		    // Inflate and set the layout for the dialog
		    // Pass null as the parent view because its going in the dialog layout
		    builder.setMessage("You must have atleast 500 bonus points to redeem. Keep saving!");
		    
		    builder.setNegativeButton("close", null);
		    
		    return builder.create();
		}
		 
	}
	
	

}
